package cn.gok.lambda;


import java.lang.reflect.Method;

class A {

}

public class class类例子 {
    public static void main(String[] args) throws ClassNotFoundException {
        class类的加载();
        获取信息类();
    }

    private static void 获取信息类() {
        Class c=A.class;
        //获取方法和成员变量
        for(Method m:c.getMethods()){
            System.out.println(m.getName()+",参数个数："+m.getParameterCount()+",返回值类型："+m.getReturnType());
        }
    }

    private static void class类的加载() throws ClassNotFoundException {
        Class c1 = Class.forName("cn.gok.lambda.A");
        System.out.println("----------");
        //2被动加载
        Class c2 = A.class;
        Class c3 = new A().getClass();
        System.out.println(c1 = c2);
        System.out.println(c2 = c3);
    }
}
